<?php
class News extends AppModel {

    public $validate = array(
    'title' => array('notEmpty'),
    'text' => array('notEmpty'),
    'user_id' => array('numeric'),
    'seo_link' => array(
    'isUnique'=>array(
    'rule' => 'isUnique',
    'message' => 'Seo link already taken'),
    'notEmpty'=>array(
    'rule'=>'notEmpty',
    'message'=>'This field cannot be left blank')
    ),
    );

    public $belongsTo = array(
    'User' =>
    array('className' => 'User',
    'foreignKey' => 'user_id',
    'conditions' => '',
    'fields' => '',
    'order' => '',
    'counterCache' => ''
    ),
    );

    public function last() {
        return $this->findAll(null,null,'News.created desc',Configure::read('Homepage.news'));
    }
}
?>